<template>
    <main class="flex-center">
		<h3 v-if="orderId">您的订单已结算，订单号为: {{ orderId }}</h3>
		<h3 v-else class="color-danger">{{ message }}</h3>
	</main>
</template>

<script>
    import orderService from '../../service/OrderService';

    /** 
     * 创建订单
     */
    export default {
        data() {
            return {
                orderId: '',    // 订单id
                message: '',    // 提示信息
            }
        },
        created() {
            orderService.createOrder()
                .then(result => {
                    if (result.isSuccess) {
                        this.orderId = result.data;
                    } else {
                        this.message = result.message;
                    }
                });
        }
    }
</script>